package com.chen.facemanager.service.impl;

import com.chen.facemanager.bean.Info;
import com.chen.facemanager.bean.User;
import com.chen.facemanager.dao.InfoDao;
import com.chen.facemanager.dao.UserDao;
import com.chen.facemanager.service.InfoService;
import com.chen.facemanager.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.Optional;

@Service
public class InfoServiceImpl implements InfoService {

    @Autowired
    private InfoDao infoDao;

    @Override
    public boolean save(String uid, String msg, String q, String img) {
        Info info = new Info();
        info.setUid(Long.parseLong(uid));
        info.setMsg(msg);
        info.setImg(img);
        info.setTel(q);

        info = infoDao.save(info);

        if (info.getId() == null){
            return false;
        }

        return true;
    }
}
